<?php
// defined('BASEPATH') OR exit('No direct script access allowed');
	class Usermodel extends CI_Model{

		const TBL_USER = 'adminuser';
		public function get_user($username,$password){
			
			$this->load->database();
			$sql = "select * from adminuser where name='$username' and password='$password'";
			$rs = $this->db->query($sql);
			return $rs->row_array();

			// $condition["name"] = $username;
			// $condition["password"] = md5($password);
			// $query = $this->db->where($condition)->get(self::TBL_USER);
			// return $query->row_array();
		}

		public function add_user($data){
			$this->load->database();
			$result = $this->db->insert("adminuser",$data);
			return $result;
		}
		//查询是否存在相同用户名
		public function alike_user($name){
			$this->load->database();
			$result = $this->db->query("select * from user where username='$name'")->result();
			return $result;
		}
	}
?>